package com.jk.controller;

import com.jk.pojo.TeamBean;
import com.jk.service.TeamService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * @author jisiqi
 * @version 1.0
 * @description: TODO
 * @date 2022/10/17 16:40
 */
@RestController
@RequestMapping("team")
public class TeamController {

    @Autowired
    private TeamService teamService;

    /**
     * @description: 查询团队管理表MySQL并新增es
     * @param:
     * @return: java.util.Map
     * @author 纪思齐
     * @date: 2022/10/17 16:46
     */
    @RequestMapping("getTeamList")
    public Map  getTeamList(){
        return teamService.getTeamList();
    }

    /**
     * @description: es中团队管理表+高亮
     * @param: teamBean
     * @return: java.util.Map
     * @author 纪思齐
     * @date: 2022/10/17 16:57
     */
    @RequestMapping("queryElasticsearchTeamList")
    public Map  queryElasticsearchTeamList(TeamBean teamBean){
        return teamService.queryElasticsearchTeamList(teamBean);
    }

    /**
     * @description: 根据团队id删除
     * @param: id
     * @return: boolean
     * @author 纪思齐
     * @date: 2022/10/17 19:57
     */
    @RequestMapping("deleteTeamId")
    public boolean  deleteTeamId(@RequestParam Integer id){
        return  teamService.deleteTeamId(id);
    }

    /**
     * @description:  根据团队id修改
     * @param: id , state
     * @return: boolean
     * @author 纪思齐
     * @date: 2022/10/19 11:41
     */
    @RequestMapping("updateState")
    public boolean updateState(Integer id , Integer state){
        return  teamService.updateState(id , state);
    }
}
